Skip to content

Conversation

@toupper
Copy link
Contributor

@toupper toupper commented Jan 18, 2023

Closes: #7757

Description

Currently we do not show the UIPrintInteractionController when requested after collecting a payment, because we dismiss the underlying order flow WooNavigationController when showing it. As the system tries to present from there, we get this error:

[Presentation] Attempt to present <UIPrintPanelNavigationController: 0x10c244c00> on <WooCommerce.WooNavigationController: 0x111808e00> (from <WooCommerce.WooNavigationController: 0x111808e00>) whose view is not in the window hierarchy.

To solve it I make the receipt printing presentation awaitable, so we can close the order flow WooNavigationController only when the printing flow is finished, whatever its end result -success, error, cancel, etc.

Testing instructions

  1. Go to Menu.
  2. Go to Payments.
  3. Tap on Collect Payment.
  4. Follow the flow and collect a payment with a card.
  5. When the payment is collected successfully, tap on Print receipt.
  6. The receipt printing controller should be presented -before it was not-.
  7. Try different printing actions -email, save to notes, cancel, etc.-.
  8. When done, it should dismiss the receipt printing flow, and then the order creation controller. (See attached video).

Screenshots

RPReplay_Final1674055160.MP4

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@toupper toupper added type: bug A confirmed bug. feature: mobile payments Related to mobile payments / card present payments / Woo Payments. labels Jan 18, 2023
@toupper toupper added this to the 12.0 milestone Jan 18, 2023
@toupper toupper requested a review from joshheald January 18, 2023 15:34
@peril-woocommerce
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 2 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS


// MARK: Success alert actions

func test_printing_receipt_from_collectPayment_success_alert_tracks_receiptPrintTapped_event() throws {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted this test case because we have it already implemented in ReceiptActionCoordinatorTests, where it feels more natural.

@toupper toupper changed the title Issue/7757 print receipt not showed [Mobile Payments] Receipt Printing Controller is not shown Jan 18, 2023
@wpmobilebot
Copy link
Collaborator

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8690-3e0a813 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@toupper toupper enabled auto-merge January 19, 2023 12:27
@joshheald joshheald self-assigned this Jan 19, 2023
Copy link
Contributor

@joshheald joshheald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well. Good spot on removing the duplicated test
🚢

@toupper toupper merged commit 3c63d8c into trunk Jan 19, 2023
@toupper toupper deleted the issue/7757-print-receipt-not-showed branch January 19, 2023 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: mobile payments Related to mobile payments / card present payments / Woo Payments. type: bug A confirmed bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Mobile Payments] Print receipt button does not print / open receipt

4 participants